package org.example.Test;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@RequestMapping("/study")
@RestController
public class studyController {
    @RequestMapping("/t1")
//    @GetMapping("/t1")
    public String t1(String name) {
        System.out.println("收到了："+name);
        return "t1的参数是："+name;
    }

    @RequestMapping("/t2")
    public String t2(String name,String id) {
        return "name:"+name+",id:"+id;
    }

    @RequestMapping("/t3")
    public String t3(MultipartFile files) throws IOException {
        System.out.println(files.getName());
        System.out.println(files.getContentType());
        System.out.println(files.getOriginalFilename());
        files.transferTo(new File("D:/temp/"+files.getOriginalFilename()));
        return "接受到文件"+ files.getName();
    }
}
